package com.service.impl;

import com.dao.impl.VipImpl;
import com.service.VipService;

import static com.util.Vessel.scanner;
import static com.util.Vessel.vipSer;

public class VipSerImpl implements VipService {
    VipImpl vipImpl = new VipImpl();

    //充钱
    @Override
    public void chargeMoney(int cId, String vipPassword) {
        System.out.println("请输入充钱金额(模拟微信/支付宝/现金支付):");
        double money = scanner.nextDouble();
        vipImpl.chargeMoney(cId,vipPassword,money);
        System.out.println("充值成功");
        vipBalance(cId,vipPassword);
    }

    //余额查询
    @Override
    public void vipBalance(int cId, String vipPassword) {
        double balance = vipImpl.vipBalance(cId,vipPassword);
        System.out.println("余额: " + balance +" 元");
    }

    //开通会员
    @Override
    public void joinVip(int cId) {
        System.out.println("请设置vip支付密码:");
        String inputPassword = scanner.next();
        vipImpl.joinVip(cId,inputPassword);
        System.out.println("1:去充值    2:退出");
        int choice = scanner.nextInt();
        switch(choice){
            case 1:
                chargeMoney(cId,inputPassword);
                break;
            case 2:
                break;
        }
    }

    public static void main(String[] args) {
        vipSer.chargeMoney(103,"123");
    }
}
